<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>角色管理 角色管理</title>
<link href="${rc.contextPath}/common/css/common/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${rc.contextPath}/common/js/thickbox/jquery.js"></script>
<script type="text/javascript" src="${rc.contextPath}/common/js/config.js"></script>
<script type="text/javascript" src="${rc.contextPath}/common/js/thickbox/thickbox.js"></script>
<link rel="stylesheet" href="${rc.contextPath}/common/js/zTree/css/zTreeStyle/zTreeStyle.css" type="text/css"/>
<script type="text/javascript" src="${rc.contextPath}/common/js/zTree/js/jquery.ztree.core-3.5.js"></script>
<script type="text/javascript" src="${rc.contextPath}/common/js/zTree/js/jquery.ztree.excheck-3.5.js"></script>
<script type="text/javascript" src="${rc.contextPath}/common/js/zTree/js/jquery.ztree.exhide-3.5.js"></script>
<style type="text/css">
	.role{border:solid 1px gray; width:500px; height:450px;display:none; z-index:101;position:absolute; background-color:#FFFFFF;}
	.role .title{width:100%;height:20px;line-height:50px; border-top:solid 1px red;background-color:#b60613;top:0px;}
	#greyBackGround{background:#000000;width:100%; display:none; z-index:100; top:0px; left:0px; position:absolute;}
</style>
<script type="text/javascript">
var addRoleTree =$resourcesTree;
</script>
<script type="text/javascript" src="${rc.contextPath}/common/js/main.js"></script>
<script type="text/javascript" src="${rc.contextPath}/common/js/authority/role.js"></script>
</head>

<body>
<input type="hidden" id="rootPath" value="${rc.contextPath}"/>
<div class="main">
  <div class="position">
	  <div class="p_left">当前位置：角色管理> 角色管理</div>
	  <div class="p_right">
	     <dl><dt>姓名：</dt><dd>${currentUser.ename}</dd></dl>
	     <dl><dt>登录时间：</dt><dd><span id="nowDate"></span></dd></dl>
	  </div>
  </div>
  <!--可拖动 上部分-->
  <div class="topBox">
    <div class="mesCheck">
      <div class="title1"><strong>角色管理</strong></div>
      <div class="box2C">
      <div style="padding-left: 10px;" class="tableForm tab1"><br/>
       #if($shiro.hasPermission("角色条件查询"))
	      <form id="queryForm" action="${rc.contextPath}/authority/role/getRoleByRoleName" method="post">
	       	角色名称&nbsp;&nbsp;
	      	<input id="pageNow" name="pageNow" type="hidden" />
	      	<input id="roleName" name="roleName" maxlength="100"/>&nbsp;&nbsp;&nbsp;&nbsp;
	      	<input id="queryRole" type="button" value="查询"/>
	      </form>   
	   #end 
	      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	      #if($shiro.hasPermission("添加角色"))
	      <input id="addRole" style="margin-right: 20px;" type="button" value="添加"/> <br/><br/>
	       #end 
	      <div><strong>角色列表</strong></div>
     </div>
	<div>
		<table class="tab2" cellpadding="0" align="center" width="100%">
		  	<tr align="center" >
		  		<th width="10%">角色名称</th>
		  		<th width="15%">操作</th>
		  	</tr>
		  	#if($pageView.records)
		  		#foreach( $role in $pageView.records)
		  		<tr align="center" >
			  		<td>$role.name</td>
			  		<td align="center">
			  			#if($shiro.hasPermission("查看角色"))
			  				<a href="javaScript:queryRole('$role.id','$role.name','$role.receiveCustom')" style="text-decoration: underline;">查看<a/>&nbsp; &nbsp; &nbsp;
			  			 #end
			  			#if($shiro.hasPermission("修改角色"))
			  				<a href="javaScript:modifyRole('$role.id','$role.name','$role.receiveCustom')" style="text-decoration: underline;">修改<a/>  &nbsp; &nbsp; &nbsp;
			  			#end
			  			#if($shiro.hasPermission("删除角色"))
			  				<a href="javaScript:delRole('$role.id')" >删除<a/>
			  			 #end
			  		</td>
			    </tr>  
				#end
			#end
	  </table>
	</div><br/>
	<!-- #BeginLibraryItem "/Library/page.lbi" -->
	#set($pageNow=$pageView.pageNow)
	#set($pageNext=$pageView.pageNow+1)
	#if($pageView.pageNow==1)
		 #set($pageBack=$pageView.pageNow)
	#else
		 #set($pageBack=$pageView.pageNow - 1)
	#end
    #set($startRecord=($pageNow*$pageView.pageSize)-$pageView.pageSize+1)
    #set($endRecord=($pageNow*$pageView.pageSize))
    <input type="hidden" value="${pageView.pageCount}" id="pageCount"/>
    <div class="page clearfix">
      <ul class="le">
	        <li>显示<span>${startRecord}-${endRecord}</span>条</li>
	        <li>共<span>${pageView.rowCount}</span>条</li>
	        <li>第&nbsp;<span>${pageView.pageNow}</span>&nbsp;页</li>
      </ul>
      <ul class="ri">
        <li><a href="javascript:;configPageController('jump')" class="go">&nbsp;</a></li>
        <li>到
          <input type="text" class="input" id="pageJump" size="4" />
          页</li>
        <li><a href="javascript:;configPageController('${pageView.pageCount}')" class="btn">[末页]</a></li>
        <li><a href="javascript:;configPageController('${pageNext}')" class="btn">[下页]</a></li>
        <li><a href="javascript:;configPageController('${pageBack}')" class="btn">[前页]</a></li>
        <li><a href="javascript:;configPageController('1')" class="btn">[首页]</a></li>
      </ul>
    </div>
    <!-- #EndLibraryItem -->

<script>
//分页
function configPageController(value) {
	var pageCount=$("#pageCount").val();
	if(value<1){
		value=1;
	}
	if(value=="jump"){
		value=$("#pageJump").val();
	}
	if(parseInt(value)>parseInt(pageCount)){
		value=pageCount;
	}
	if(!$isQuery){
		window.location="${rc.contextPath}/authority/role/rolePage?pageNow="+value;
	}else{
		$("#pageNow")[0].value=value;
		$("#queryForm").submit();
	}	
}
</script>


<div id="addRoleDiv" class="role" style="overflow-x: auto; overflow-y: auto;">
	<div class="title"></div>
	<div style="margin-left: 20px;">添加角色</div>
	<div style="margin-left: 20px;">
	<!-- 	<form id="addResourcesForm" action="../../authority/role/addRole" method="post">
		<input id="addResourcesIdStr" name="resourcesIdStr" />
		</form> -->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		角色名称：<input id="addResourcesRoleName" name="roleName" />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input id="addRoleBtn" type="button" value="保存" />
		<input id="addRoleBtnCancel" type="button" value="返回" /><br/>
		是否能接收客户：
		<select id="addReceiveCustom" name="receiveCustom" style="width: 130px;">
			<option value="">----请选择----</option>
			<option value="0">否</option>
			<option value="1">是</option>
		</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/>
		<div style="float: left;">授权:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
		<div class="zTreeDemoBackground left" style="overflow-x: auto; overflow-y: auto;float: left;">
			<ul id="addResourcesTree" class="ztree" style="height:300px;width:230px;"></ul>
		</div>
		<br/>
	</div> 
</div>

<div id="queryRoleDiv" class="role" style="overflow-x: auto; overflow-y: auto;">
	<div class="title"></div>
	<div style="margin-left: 20px;">查看角色</div>
	<div style="margin-left: 20px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		角色名称：<input id="queryRoleName"  name="resourcesIdStr" readonly="readonly" />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input id="queryRoleBtnCancel" type="button" value="返回" /><br/>
		是否能接收客户：
		<select id="queryReceiveCustom" name="receiveCustom" style="width: 130px;">
			<option value="0">否</option>
			<option value="1">是</option>
		</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/>
		<div style="float: left;">授权:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
		<div class="zTreeDemoBackground left" style="overflow-x: auto; overflow-y: auto;float: left;">
			<ul id="queryResourcesTree" class="ztree" style="height:300px;width:230px;"></ul>
		</div>
		<br/>
	</div> 
</div>
<div id="modifyRoleDiv" class="role" style="overflow-x: auto; overflow-y: auto;">
	<div class="title"></div>
	<div style="margin-left: 20px;">修改角色</div>
	<div style="margin-left: 20px;">
				 <input id="modifyRoleId" type="hidden" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		角色名称：<input id="modifyRoleName" name="roleName" maxlength="100" />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input id="modifyRoleBtn" type="button" value="修改" />
		<input id="modifyRoleBtnCancel" type="button" value="返回" /><br/>
		
		是否能接收客户：
		<select id="modifyReceiveCustom" name="receiveCustom" style="width: 130px;">
			<option value="">----请选择----</option>
			<option value="0">否</option>
			<option value="1">是</option>
		</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/>
		<div style="float: left;">授权:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
		<div class="zTreeDemoBackground left" style="overflow-x: auto; overflow-y: auto;float: left;">
			<ul id="modifyResourcesTree" class="ztree" style="height:300px;width:230px;"></ul>
		</div>
		<br/>
	</div> 
</div> <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
	  </div>
    </div>
  </div>
</div>
<!--可拖动 上部分end-->

</body>
</html>
